package com.example.sharding.demo.dao;

import com.example.sharding.demo.model.BaseEntity;
import com.example.sharding.demo.model.table.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {
	
    int deleteUserById(String id);

    int insertUser(User record);

    User findUser(BaseEntity<User> record);

    int updateUser(User record);

    @Update("update ${tableName} SET `name` = '${name}' where id = ${id}")
    int updateUserName(@Param("tableName") String tableName, @Param("name") String name, @Param("id") Integer id);

    int countUserByName(String name);
    
    List<User> findUserList(BaseEntity<User> record);

    String procUserLoginLog(Map record);

    Integer procUpdateUserErrorCount(Map record);

}